from machine import Pin, PWM
import time

"""
无源蜂鸣器
"""

Beep = PWM(Pin(4), freq=200, duty=500)  # 在同一语句下创建和配置 PWM，C3最低频率40Hz

# 蜂鸣器发出频率200Hz响声
Beep.freq(200)
time.sleep(1)

# 蜂鸣器发出频率400Hz响声
Beep.freq(400)
time.sleep(1)

# 蜂鸣器发出频率600Hz响声
Beep.freq(600)
time.sleep(1)


# 蜂鸣器发出频率800Hz响声
Beep.freq(800)
time.sleep(1)


# 蜂鸣器发出频率1000Hz响声
Beep.freq(1000)
time.sleep(1)

# 停止
Beep.deinit()
